
#ifndef _RECORD_H_20111127
#define _RECORD_H_20111127

#include <iostream>

namespace AirlineRes
{

/// Contains methods and data common to all Record types, e.g. CustomerRecord, FlightRecord.
///
/// Note that all records inherit their m_id member from here.
class Record
{
public:
  template <class T> friend class RecordManager; // Modifies m_id.

  Record() : m_id(-1) {};
  virtual ~Record(){};

  /// Possible results returned by a Record IO operation.
  enum RecordIOResult
  {
    RecordIOResult_Success,
    RecordIOResult_Failure,
    RecordIOResult_NumStates
  };

  /// Attempt to load Record data from the specified istream.
  ///
  /// @param _stream  The istream from which to extract record fields.
  ///
  /// @return  An error code represting whether or not the operation was a success.
  virtual RecordIOResult LoadRecord( std::istream& _stream ) =0;

  /// Attempt to write this Record to the specified ostream.
  ///
  /// @param _stream  The ostream to write record fields to.
  ///
  /// @return  An error code represting whether or not the operation was a success.
  virtual RecordIOResult WriteRecord( std::ostream& _stream ) const =0;

  /// @return The unique id corresponding to this record of this RecordType.
  int GetID() const { return m_id; };
protected:
  int m_id;
};

} // namespace AirlineRes

#endif // _RECORD_H_20111127
